//
//  MyDemoTests.m
//  MyDemoTests
//
//  Created by jay on 2020/8/22.
//  Copyright © 2020 jay. All rights reserved.
//

#import <XCTest/XCTest.h>
#import "TXDateTimeService.h"
#import "MainVM.h"
#import "HistoryVM.h"

@interface MyDemoTests : XCTestCase

@end

@implementation MyDemoTests

- (void)setUp {
    // Put setup code here. This method is called before the invocation of each test method in the class.
}

- (void)tearDown {
    // Put teardown code here. This method is called after the invocation of each test method in the class.
}

- (void)testExample {
    // This is an example of a functional test case.
    // Use XCTAssert and related functions to verify your tests produce the correct results.
}

//测试时间转换
-(void)testConvertTimeInterval {
    
    NSString *strTime = [[TXDateTimeService sharedInstance] stringFromTimeInterval:1598114911 format:@"YYYY-MM-dd HH:mm:ss"];
    
    XCTAssertNotNil(strTime);
}

//测试主页面接口数据请求
-(void)testGetMainData {
    
    MainVM *vm = [[MainVM alloc] init];
    
    [vm getDataFromNetCompleteHandle:^(NSError * _Nonnull error) {
        
        XCTAssertTrue(vm.curModel);
    }];
}

//测试获取历史记录数据
-(void)testGetHistoryData {
    
    HistoryVM *vm = [[HistoryVM alloc] init];
    
    [vm getDataFromNet:NO completeHandle:^(NSError * _Nonnull error) {
        
        XCTAssert([vm rowNumber] > 0);
    }];
}

- (void)testPerformanceExample {
    // This is an example of a performance test case.
    [self measureBlock:^{
        // Put the code you want to measure the time of here.
    }];
}

@end
